package com.xxgc.helloword.controller;

import com.xxgc.helloword.po.Info;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

//接口类
@Controller
@PropertySource(value = "classpath:system.properties")
//映射请求
@RequestMapping("/info")
@Api(value = "hello接口",tags = "用于返回信息",description = "返回信息")
public class HelloController {
    @Value("${system.name}")
    private String system;

    @ApiOperation(value = "获取helloWord",notes = "获取helloWord")
    //getMsg接口
    @GetMapping("/getMsg")
    @ResponseBody
    public Info getMsg(){
        return new Info(200,system+"YinYue");
    }

    @ApiOperation(value = "给什么返回什么的方法",notes = "你传什么就返回什么")
    //给什么返回什么的方法
    @GetMapping("/getYourMsg")
    @ResponseBody
    public Info getYourMsg(@ApiParam(name = "msg",value = "信息",required = true) String msg){
        return new Info(-201,msg);
    }
}
